/**
* Copyright (c) 2013-2014, qtone Inc. All Rights Reserved.
*
* @author: tanghuaicheng
* Project Name: testuc
* $Id:   2017-01-11 10:54:07 $
*/
package com.bangcommunity.bbframe.common.base;

public class BaseQuery implements java.io.Serializable {
    private static final long serialVersionUID = 1L;
    public static final int SORT_TYPE_DEFAULT = 0; /* 默认排序，db本身行为 */
    public static final int SORT_TYPE_GMT_CREATE = 1; /* 创建时间 增序 */
    public static final int SORT_TYPE_GMT_CREATE_DESC = 2; /* 创建时间倒序 desc */
    public static final int SORT_TYPE_GMT_MODIFIED = 3; /* 修改时间增序 */
    public static final int SORT_TYPE_GMT_MODIFIED_DESC = 4; /* 修改时间倒序 desc */
    /**
     * 第几页
     */
    protected Integer pageNo = 1;
    protected Integer pageSize = 100;
    protected Integer sortType = SORT_TYPE_GMT_CREATE_DESC;

    public Integer getLineStart() {
        return Math.max((pageNo - 1) * pageSize, 0);
    }

    public Integer getOffSet() {
        return Math.max((pageNo - 1) * pageSize, 0);
    }

    public void setSortType(Integer sortType) {
        this.sortType = sortType;
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getSortType() {
        return sortType;
    }
}